package com.gobang.domain.message;

import lombok.*;

/**
 * 心跳响应消息DTO
 * 客户端向服务器发送的心跳响应消息
 * 
 * @author System
 * @since 1.0.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class HeartbeatResponseMessage extends WebSocketMessage {
    
    /**
     * 心跳响应数据
     */
    private HeartbeatResponseData data;
    
    /**
     * 心跳响应数据内部类
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class HeartbeatResponseData {
        /**
         * 时间戳
         */
        private Long timestamp;
    }
    
    /**
     * 构造函数
     */
    public HeartbeatResponseMessage(HeartbeatResponseData data) {
        super("HEARTBEAT_RESPONSE");
        this.data = data;
    }
    
    /**
     * 创建心跳响应消息
     *
     * @return 心跳响应消息实例
     */
    public static HeartbeatResponseMessage create() {
        HeartbeatResponseData data = HeartbeatResponseData.builder()
                .timestamp(System.currentTimeMillis())
                .build();
        return new HeartbeatResponseMessage(data);
    }
} 